package Day10;

/**
 * @Author kalista
 * @Description 字符串
 * @Date 2020/11/16  15:06
 **/
public class StringUtil {


    /**
     * 根据字符串进行反转
     * @param str
     * @return
     */
    public static String reversal(String str){
        if (str == null || "".equals(str) || str.isEmpty()){
            return "";
        }
        char start = str.charAt(0);
        char end = str.charAt(str.length()-1);
        String context = str.substring(1,str.length()-1);
        StringBuilder stringBuilder = new StringBuilder(context);
        return start+ stringBuilder.reverse().toString() + end;
    }




}
